﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Data.SqlClient;


namespace TravelForwardContracts
{
    public partial class AllReportsForm : Form
    {
        private String m_savePath;
        private bool m_isIgnoreZeroRecord;

        public AllReportsForm()
        {
            InitializeComponent();
            m_savePath = null;
            m_isIgnoreZeroRecord = true;

            if (m_isIgnoreZeroRecord)
                checkBoxIgnoreZero.Checked = true;

        }

        private void buttonClose_Click(object sender, EventArgs e)
        {
            try
            {
                this.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error:" + ex.Message, "Close Exception",
                    System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
            }
        }

        private void buttonGenerateAllReport_Click(object sender, EventArgs e)
        {
            String strSavePath = textBoxSavePath.Text;
            if (strSavePath == "")
            {
                MessageBox.Show("Please specify save path", "Save Path Error",
                    System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                return;
            }

            if (!Directory.Exists(strSavePath))
            {
                MessageBox.Show("Please specify valid save path", "Save Path Error",
    System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                return;
            }
            
            // Lock 
            buttonGenerateAllReport.Enabled = false;
            String sqlDistinctClientId = "SELECT DISTINCT ClientId FROM allrecords";




            
        }

        private void buttonBrowse_Click(object sender, EventArgs e)
        {
            FolderBrowserDialog browseDialog = new FolderBrowserDialog();
            DialogResult result = browseDialog.ShowDialog();
            if (result == DialogResult.OK)
            {
                textBoxSavePath.Text = browseDialog.SelectedPath;

            }
        }

    }
}
